package com.job.common.converter;
import com.job.pojo.Position;
import com.job.pojo.vo.PositionVO;
import org.springframework.stereotype.Component;

import java.util.HashMap;

@Component
public class PositionFieldConverter {

    private static final HashMap<Integer,String> xlMap = new HashMap<Integer,String>(){{
        put(0,"大专");
        put(1,"本科");
        put(2,"研究生");
        put(3,"博士");
    }};

    public PositionVO PositionPoToVoConverter(Position position){
        PositionVO positionVO = new PositionVO();
        positionVO.setPositionId(position.getPositionId());
        positionVO.setPosition(position.getPosition());
        positionVO.setCorporationId(position.getCorporationId());
        positionVO.setHrId(position.getHrId());
        positionVO.setCreateTime(position.getCreateTime());
        positionVO.setXl(xlMap.get(position.getXl()));
        positionVO.setSalary(position.getSalaryStart() + "k-" + position.getSalaryEnd() + "k"
        + "." + position.getAward() + "薪");
        positionVO.setAdvantage(position.getAdvantage());
        return positionVO;
    }
}
